/**
 * 
 */
package Phase1;

/**
 * @author byu.ryanpadilla
 * @invariant localID>0 , no duplication in local
 * @domain ID from 0 to positive infinite
 *
 */
public class LocalID  implements java.io.Serializable
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;	
	private static int nextIDToAssign;
	private int localID;
	
	public LocalID()
	{

		localID = nextIDToAssign++;
	}
	/*
	 * This Method needs to get the remote nextIDToAssign on another machine
	 * Haven't figured out how to do that yet
	public LocalID(String host, int p)
	{
		ObjectDB objDB = ObjectDB.getDatabase();
		int highestID =  objDB.getHighestID(host, p);
		if(highestID != -1)
		{
			nextIDToAssign = highestID + 1;
		}
		localID = nextIDToAssign++;
	}*/
	
	public int getLocalID()
	{
		return localID;
	}
	
	public String toString()
	{
		return "LocalID: " + this.localID;
	}

}
